package com.jing.system.comm.enums;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 粉丝或关注的类型
 * 		[0粉丝/1关注/2互相关注]
 * @author jing.yue
 * @version 1.0
 * @since 2012-08-31
 */
public enum FansAttentionType {
	/** 我的粉丝 */
	TYPE_FANS("fans", "我的粉丝"),
	/** 我的关注 */
	TYPE_ATTENTION("attention", "我的关注"),
	/** 互相关注 */
	TYPE_FANS_ATTENTION("fans_attention", "互相关注"),
	/** 榜上有名[评论] */
	TYPE_RANKING_COMMENT("ranking_comment", "榜上有名[评论]"),
	/** 榜上有名[@] */
	TYPE_RANKING_AT("ranking_at", "榜上有名[@]");

	private String code;

	private String text;

	public static Map<String, String> map;

	public static Map<String, String> init(){
		if(map == null){
			map = new LinkedHashMap<String, String>();
			map.put(TYPE_FANS.code, TYPE_FANS.text);
			map.put(TYPE_ATTENTION.code, TYPE_ATTENTION.text);
			map.put(TYPE_FANS_ATTENTION.code, TYPE_FANS_ATTENTION.text);
			map.put(TYPE_RANKING_COMMENT.code, TYPE_RANKING_COMMENT.text);
			map.put(TYPE_RANKING_AT.code, TYPE_RANKING_AT.text);
		}
		return map;
	}

	/**
	 * 根据Code获取对应的汉字
	 * @param code
	 * @return
	 */
	public static String getCodeByText(String code) {
		init();
		return map.get(code);
	}

	public static Map<String, String> getMap() {
		init();
		return map;
	}

	private FansAttentionType(String code, String text) {
		this.code = code;
		this.text = text;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}
}